<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/templates/template_admin.xhtml">
        <ui:define name="content">
            <f:view>
                <h:form>
                    <h1><h:outputText value="Edit Emloyee"/></h1>
                    <h:panelGrid columns="2">
                        <h:outputLabel value="EmployeeID:" for="employeeID" />
                        <h:inputText id="employeeID" value="#{emb.em.employeeID}" title="EmployeeID" required="true" requiredMessage="The EmployeeID field is required."/>
                        <h:outputLabel value="FirstName:" for="firstName" />
                        <h:inputText id="firstName" value="#{emb.em.firstName}" title="FirstName" required="true" requiredMessage="The FirstName field is required."/>
                        <h:outputLabel value="LastName:" for="lastName" />
                        <h:inputText id="lastName" value="#{emb.em.lastName}" title="LastName" required="true" requiredMessage="The LastName field is required."/>
                        <h:outputLabel value="Gender:" for="gender" />
                        <h:selectOneMenu id="gender"
                                         value="#{emb.em.gender}"
                                         styleClass="text-input medium-input">
                            <f:selectItem itemLabel="Male" itemValue="#{true}"/>
                            <f:selectItem itemLabel="Female" itemValue="#{false}" />
                        </h:selectOneMenu>
                        <h:outputLabel value="Dob:" for="dob" />
                        <p:calendar value="#{emb.em.dob}"
                                    id="dob"
                                    navigator="true"
                                    yearRange="c-50:c+50"
                                    mindate="1/1/62"
                                    maxdate="#{calendarMB.currentDate}"
                                    pattern="yyyy-MM-dd"
                                    styleClass="remove"
                                    required="true"
                                    requiredMessage="You must enter date of birth."
                                    validator="#{vlmb.validateDOB}">
                        </p:calendar>                       
                        <h:outputLabel value="PhoneNumber:" for="phoneNumber" />
                        <h:inputText id="phoneNumber" value="#{emb.em.phoneNumber}" required="true" validator="#{vlmb.validatePhoneNumber}"/>
                        <h:outputLabel value="Email:" for="email" />
                        <h:inputText value="#{emb.em.email}"
                                     styleClass="text-input medium-input"
                                     id="email"
                                     required="true"
                                     requiredMessage="You must enter email address."
                                     validator="#{vlmb.validate}"/>
                        <h:outputLabel value="Address:" for="address" />
                        <h:inputText id="address" value="#{emb.em.address}" title="Address" />
                        <h:outputLabel value="Position:" for="position" />
                        <h:inputText id="position" value="#{emb.em.position}" title="Position" />                       
                        <h:outputLabel value="DepartmentID:" for="departmentID" />
                        <h:selectOneMenu id="departmentID" value="#{emb.departmentID}">
                            <f:selectItems var="d" value="#{dmb.depList()}" itemLabel="#{d.name}" itemValue="#{d.departmentID}"></f:selectItems>                        
                        </h:selectOneMenu>
                    </h:panelGrid>
                    <h:commandButton action="#{emb.editem()}" value="Update"/>
                    <br />
                    <h:commandButton action="List" value="Back"/>
                    <br />
                </h:form>
            </f:view>

        </ui:define>
    </ui:composition>

</html>
